# Contributor: Dmitry Zakharchenko <dmitz@disroot.org>
# Maintainer: Dmitry Zakharchenko <dmitz@disroot.org>
pkgname=ytmdl
pkgver=2023.7.27
pkgrel=0
pkgdesc="Download songs with metadata from Youtube"
url="https://github.com/deepjyoti30/ytmdl"
arch="noarch !armhf !ppc64le" # limited by py3-youtube-search
license="MIT"
depends="python3
		py3-beautifulsoup4
		py3-colorama
		py3-downloader-cli
		py3-ffmpeg
		py3-itunespy
		py3-lxml
		py3-musicbrainzngs
		py3-mutagen
		py3-pydes
		py3-pysocks
		py3-requests
		py3-rich
		py3-simber
		py3-spotipy
		py3-unidecode
		py3-urllib3
		py3-xdg
		py3-youtube-search
		py3-ytmusicapi
		yt-dlp
		"
makedepends="py3-setuptools"
options="!check" # no test suite
subpackages="$pkgname-bash-completion $pkgname-zsh-completion $pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/y/ytmdl/ytmdl-$pkgver.tar.gz"

prepare() {
	default_prepare
	sed -e '/install_requires/d/setup_requires/d' -i setup.py
#		-e 's|etc/bash_completion.d|usr/share/bash-completion/completions|' \
#		-e 's|zsh/functions/Completion/Unix|zsh/site-functions|' \
#		setup.py
}

build() {
	export SETUPTOOLS_USE_DISTUTILS=stdlib
	python3 setup.py build
}

package() {
	export SETUPTOOLS_USE_DISTUTILS=stdlib
	python3 setup.py install --skip-build --root="$pkgdir"

	rm -r "$pkgdir"/etc/bash_completion.d "$pkgdir"/usr/share/zsh/functions
	install -Dm644 ytmdl.bash \
		"$pkgdir"/usr/share/bash-completion/completions/"$pkgname"
	install -Dm644 ytmdl.zsh \
		"$pkgdir"/usr/share/zsh/site-functions/_"$pkgname"
}

sha512sums="
b300590f1aae0378c3672df24b766c6729b034711f83102881f0bd81d7d383825f3187c6f28611c38ad634542b8eb4bbe2c4fcb8a946b7eef9be492a3bfee927  ytmdl-2023.7.27.tar.gz
"
